/*
 * QrImage.cpp
 *
 *  Created on: 12/07/2011
 *      Author: Berg
 */

#include "QrImage.hpp"
#include <iostream>

QrImage::QrImage(const unsigned char* data, unsigned int width) {

	this->encps = new Imagem(width, width,1);

	for (unsigned int i = 0; i < width; i++) {

		for (unsigned int j = 0; j < width; j++) {

//			std::cout << i * width + j << std::endl;
			int k = data[i * width + j] & 0;
//			std::cout << k << std::endl;
			if (data[j * width + i] & 0 == 0) {
				this->encps->set(i, j, 0, 0);
			} else{
				this->encps->set(i, j, 0, 255);
			}
		}
	}
}

QrImage::~QrImage(void) {

	delete this->encps;
}

Imagem* QrImage::getImage(){
	return this->encps;
}

